<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>付款资料信息</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
    <script type="text/javascript" src="//cdn.staticfile.org/webuploader/0.1.5/webuploader.min.js" charset="utf-8">
    </script>
    <script src="//cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js"></script>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="fieldset1 tabel_col tabel_col_s clearFix">
        <div class="sqPanel">
            <div class="sqPanel_head inL" >
            	<c:if test="${ctrlKey==2}">
            	<span class="sq-button sq-button-round " onclick="addPrjfiles('mateGrid');">需补充资料</span>
            	</c:if>
                <span>租赁物资料</span>
                <span class="sq-button sq-button-round" onclick="downloadFileByUrl('mateGrid');">打包下载</span>
            </div>
            <div class="sqPanel_body">
                <div id="mateGrid1" class="sq-grid"></div>
            </div>
        </div>
        <div class="sqPanel">
            <div class="sqPanel_head inL" >
                <span>发票资料</span>
                <span class="sq-button sq-button-round" onclick="downloadFileByUrl('invoiceGrid');">打包下载</span>
            </div>
            <div class="sqPanel_body">
                <div id="invoiceGrid" class="sq-grid"></div>
            </div>
        </div>

        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>保单列表</span>
            </div>
            <div class="sqPanel_body">
                <div id="insPlcBscInfoListGrid" class="sq-grid"></div>
            </div>
        </div>

        <%--<div id="sqLsCnt" class="sqPanel" style="display: none">--%>
            <%--<div class="sqPanel_head inL">--%>
                <%--<span>狮桥对客合同</span>--%>
                <%--<span class="sq-button sq-button-round" onclick="downloadFileByUrl('sqLsCntGrid');">打包下载</span>--%>
            <%--</div>--%>
            <%--<div class="sqPanel_body">--%>
                <%--<div id="sqLsCntGrid" class="sq-grid"></div>--%>
            <%--</div>--%>
        <%--</div>--%>

        <%--<div id="thirdLsCnt" class="sqPanel" style="display: none">--%>
            <%--<div class="sqPanel_head inL">--%>
                <%--<span>三方对客合同</span>--%>
                <%--<span class="sq-button sq-button-round" onclick="downloadFileByUrl('thirdLsCntGrid');">打包下载</span>--%>
            <%--</div>--%>
            <%--<div class="sqPanel_body">--%>
                <%--<div id="thirdLsCntGrid" class="sq-grid"></div>--%>
            <%--</div>--%>
        <%--</div>--%>

        <%--<div id="thirdVideo" class="sqPanel" style="display: none">--%>
            <%--<div class="sqPanel_head inL">--%>
                <%--<span>三方对客视频</span>--%>
                <%--<span class="sq-button sq-button-round" onclick="downloadFileByUrl('thirdVideoGrid');">打包下载</span>--%>
            <%--</div>--%>
            <%--<div class="sqPanel_body">--%>
                <%--<div id="thirdVideoGrid" class="sq-grid"></div>--%>
            <%--</div>--%>
        <%--</div>--%>

        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>客户资料</span>
                <span class="sq-button sq-button-round" onclick="downloadFileByUrl('cstFileInfoCfgGrid');">打包下载</span>
            </div>
            <div class="sqPanel_body">
                <div id="cstFileInfoCfgGrid" class="sq-grid"></div>
            </div>
        </div>
        <div class="sqPanel">
            <div class="sqPanel_head inL">
            	<c:if test="${ctrlKey==2}">
            	<span class="sq-button sq-button-round" onclick="addPrjfiles('prjFileInfoCfgGrid');">需补充资料</span>
            	</c:if>
                <span>项目资料</span>
                <span class="sq-button sq-button-round" onclick="downloadFileByUrl('prjFileInfoCfgGrid');">打包下载</span>
            </div>
            <div class="sqPanel_body">
                <div id="prjFileInfoCfgGrid" class="sq-grid"></div>
            </div>
        </div>

    </div>

    <input type="text" style="display: none;" id="prjPrdDtlId" name="prjPrdDtlId" value="${prjPrdDtlId}">
    <input type="text" style="display: none;" id="payId" name="payId" value="${id}">

    <input type="text" style="display: none;" id="cstId" name="cstId" value="${cstId}">
    <input type="text" style="display: none;" id="prjId" name="prjId" value="${prjId}">
</div>

<script type="text/javascript" src="<%=path%>/resource/lib/plugins/ajaxfileupload.js"></script>
<script type="text/javascript">
    //租赁物资料
    var mateGrid = null;
    //发票资料
    var invoiceGrid = null;
    //项目资料配置明细
    var prjFileInfoCfgGrid = null;
    //客户资料配置明细
    var cstFileInfoCfgGrid = null;
    //狮桥对客合同
    var sqLsCntGrid = null;
    //三方对客合同
    var thirdLsCntGrid = null;
    //三方对客视频
    var thirdVideoGrid = null;
    var thirdVideoUpload;
    var taskDefKey = "${taskDefKey}";
    var prjPrdDtlId = ${prjPrdDtlId};
    var paySchNo = "${paySchNo}";
    $(function () {
        var ctrlKey='${ctrlKey}';
        thirdVideoUpload = makeUploaders("thirdVideoGrid",2);

        mateGrid = $("#mateGrid1").ligerGrid({
            url: '<%=path%>/project/prjFileCfgInfo/initMateList.do?id=${id}&prjPrdDtlId=${prjPrdDtlId}&prjId=${prjId}&prjTypCd=${prjTypCd}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, align: 'left', enabledSort: false},
                {display: '操作', name: 'upLoadNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',1)"></span>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round fileupload-button" onclick="delFile(' + rowdata.fileId + ',\''+rowdata.orgCd+'\',1);">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if("FLOW_00000008_002_002_029" == taskDefKey || "FLOW_00000008_007_002_031" == taskDefKey){
                                }else{
                                    if(rowdata.filePath) {
                                        h += '<a class="sq-button-hasicon  button_tongguo"  style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                        h += '<a class="sq-button-hasicon  button_butongguo"  style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,1);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                    }
                                }

                            }
                        }else{
                            if(ctrlKey==1 ||ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',1)"></span>';
                            }
                        }
                        return h;
                    }
                },
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 'auto',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,

            allowUnSelectRow: true,
            alternatingRow: false,
            onAfterShowData: function (s) {
                $('#mateGrid1').rowspan('datNm');
            }
        });

        invoiceGrid = $("#invoiceGrid").ligerGrid({
            url: '<%=path%>/project/prjFileCfgInfo/initInvoiceList.do?id=${id}&prjPrdDtlId=${prjPrdDtlId}&prjId=${prjId}&prjTypCd=${prjTypCd}&paySchNo=${paySchNo}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, align: 'left', enabledSort: false},
                {display: '操作', name: 'upLoadNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<a class="sq-button sq-button-round" href="javascript:uploadInvoice(';
                                h+="'"+prjPrdDtlId+"',";
                                h+="'"+paySchNo+"',";
                                h+=')"><i class="sqBtnIco_4"></i>发票上传</a>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round" onclick="removeInvoice(' + rowdata.fileId + ',' + rowdata.orgCd + ');">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if("FLOW_00000008_002_002_029" == taskDefKey || "FLOW_00000008_007_002_031" == taskDefKey){
                                }else{
                                    if(rowdata.filePath) {
                                        h += '<a class="sq-button-hasicon  button_tongguo"  style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,7);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                        h += '<a class="sq-button-hasicon  button_butongguo"  style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,7);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                    }
                                }
                            }
                        }else{
                            if(ctrlKey==1 ||ctrlKey==4){
                                h+='<a class="sq-button sq-button-round" href="javascript:uploadInvoice(';
                                h+="'"+prjPrdDtlId+"',";
                                h+="'"+paySchNo+"',";
                                h+=')"><i class="sqBtnIco_4"></i>发票上传</a>';
                            }
                        }
                        return h;
                    }
                },
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 'auto',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,

            allowUnSelectRow: true,
            alternatingRow: false,
            onAfterShowData: function (s) {
                $('#mateGrid1').rowspan('datNm');
            }
        });

        $("#insPlcBscInfoListGrid").ligerGrid({
            url: '<%=path%>/insurance/insPlcBscInfo/initList.do?prjPrdDtlId=${prjPrdDtlId}',
            method : 'get',
            columns: [
                { display: '支付表编号', name: 'paySchNo', width: 300,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if(rowdata.paySchNo){
                            h+='<a class="sq-button-hasicon" href="javascript:detailBtn(';
                            h+="'"+rowdata.id+"',";
                            if(rowdata.paySchId){
                                h+="'"+rowdata.paySchId+"',";
                            }else{
                                h+="'',";
                            }
                            h+="'"+rowdata.prjPrdId+"'";
                            h+=')">'+value+'</a>'
                        }
                        return h;
                    }
                },
                {display: '保单号', name: 'plcNo', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(!value||value==null||value=='null'){
                            return '<a href="javascript:;" onclick="queryPlcDtl('+rowdata.id+')">保单</a>';
                        }
                        return '<a href="javascript:;" onclick="queryPlcDtl('+rowdata.id+')"><span class="gridTip" title="保单查看">'+rowdata.plcNo+'</span></a>';
                    }
                },
                {
                    display: '操作',
                    isSort: false,
                    width: 130,
                    render: function (rowdata, rowindex, value){
                        var h="";
                        h='<a class="sq-button-hasicon" href="javascript:uploadInsPlcBscInfoFile(';
                        h+="'"+rowdata.id+"',";
                        h+="'"+rowdata.prjId+"'";
                        h+=')"><i class="sqBtnIco_4"></i>资料信息</a>';
                        return h;
                    }
                }
            ],
            pageSize:100,
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            usePagerOnLessPagesize: true,
            onAfterShowData: function ()
            {
                SetIframe_height();
            },
        });

        //客户资料配置明细Grid
        cstFileInfoCfgGrid = $("#cstFileInfoCfgGrid").ligerGrid({
            <%--url: '<%=path%>/project/prjFileInfo/initCstFileInfoList.do?cstMgrOrgCd=${cstMgrOrgCd}&cstId=${cstId}',--%>
            url: '<%=path%>/project/prjFileCfgInfo/initCstFileInfoList.do?isShowSts=1&type=1&cstMgrOrgCd=${cstMgrOrgCd}&cstId=${cstId}&prjId=${prjId}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',2)"></span>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round fileupload-button" onclick="delFile(' + rowdata.fileId + ',\''+rowdata.orgCd+'\',2);">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if(rowdata.filePath) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,2);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',2)"></span>';
                            }
                        }
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: 'auto',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#cstFileInfoCfgGrid').rowspan('datNm');
            },
        });

        //项目资料Grid
        prjFileInfoCfgGrid = $("#prjFileInfoCfgGrid").ligerGrid({
            <%--url: '<%=path%>/project/prjFileCfgInfo/initPrjFileInfoList.do?cstMgrOrgCd=${cstMgrOrgCd}&prjId=${prjId}&prjTypCd=${prjTypCd}',--%>
            url: '<%=path%>/project/prjFileCfgInfo/initPrjFileInfoList.do?isShowSts=1&cstMgrOrgCd=${cstMgrOrgCd}&prjId=${prjId}&prjTypCd=${prjTypCd}',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',3)"></span>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round fileupload-button" onclick="delFile(' + rowdata.fileId + ',\''+rowdata.orgCd+'\',3);">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if(rowdata.filePath) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,3);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,3);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',3)"></span>';
                            }
                        }
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: 'auto',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: true,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function (){
                $('#prjFileInfoCfgGrid').rowspan('datNm');
            },
        });

        sqLsCntGrid = $("#sqLsCntGrid").ligerGrid({
            url: '<%=path%>/capital/capPayInfo/initMateList.do?id=${id}&prjId=${prjId}&mateCfgCd=PRJ019',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, align: 'left', enabledSort: false},
                {display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',4)"></span>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round fileupload-button" onclick="delFile(' + rowdata.fileId + ',\''+rowdata.orgCd+'\',4);">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if(rowdata.filePath) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,4);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,4);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            if(ctrlKey==1 ||ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',4)"></span>';
                            }
                        }
                        return h;
                    }
                },
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 'auto',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,

            allowUnSelectRow: true,
            alternatingRow: false,
            onAfterShowData: function (s) {
                $('#sqLsCntGrid').rowspan('datNm');
            }
        });

        thirdLsCntGrid = $("#thirdLsCntGrid").ligerGrid({
            url: '<%=path%>/capital/capPayInfo/initMateList.do?id=${id}&prjId=${prjId}&mateCfgCd=PRJ020',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, align: 'left', enabledSort: false},
                {display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',5)"></span>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round fileupload-button" onclick="delFile(' + rowdata.fileId + ',\''+rowdata.orgCd+'\',5);">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if(rowdata.filePath) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,5);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,5);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            if(ctrlKey==1 ||ctrlKey==4){
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',5)"></span>';
                            }
                        }
                        return h;
                    }
                },
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 'auto',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,

            allowUnSelectRow: true,
            alternatingRow: false,
            onAfterShowData: function (s) {
                $('#thirdLsCntGrid').rowspan('datNm');
            }
        });

        thirdVideoGrid = $("#thirdVideoGrid").ligerGrid({
            url: '<%=path%>/capital/capPayInfo/initMateList.do?id=${id}&prjId=${prjId}&mateCfgCd=PRJ021',
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h = rowdata.datNm;
                        if(rowdata.isMust == 1){
                            h += '(<span style="color:red;">*</span>)';
                        }
                        return h;
                    }
                },
                {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, align: 'left', enabledSort: false},
                {display: '操作', name: 'uploadNm', minWidth: 100, align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){
                            if(ctrlKey==1 || ctrlKey==4){
                                h+='<div id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" class="sq-button sq-button-round fileupload-button">上传</div>';
                                if(rowdata.audStsCd!=1) {
                                    h+='<span class="sq-button sq-button-round fileupload-button" onclick="delFile(' + rowdata.fileId + ',\''+rowdata.orgCd+'\',6);">删除</span>';
                                }
                            }else if(ctrlKey==2){
                                if(rowdata.filePath) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',1,6);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(' + rowdata.fileId + ',2,6);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            if(ctrlKey==1 ||ctrlKey==4){
                                h+='<div id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" class="sq-button sq-button-round fileupload-button">上传</div>';
                            }
                        }
                        return h;
                    }
                },
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 'auto',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,

            allowUnSelectRow: true,
            alternatingRow: false,
            onAfterShowData: function (currentData) {
                $('#thirdVideoGrid').rowspan('datNm');
                var arguments = [];
                for (var i = 0; i < currentData.rows.length; i++) {
                    var isExt = false;
                    for (var j = 0; j < arguments.length; j++) {
                        if(arguments[j].cfgCd==currentData.rows[i].cfgCd && arguments[j].cfgDtlCd==currentData.rows[i].cfgDtlCd){
                            isExt = true;
                            break;
                        }
                    }
                    if(!isExt){
                        arguments.push(currentData.rows[i]);
                    }
                }
                for (var j = 0; j < arguments.length; j++) {
                    thirdVideoUpload.addButton({
                        id: '#fileup_'+arguments[j].cfgCd+'_'+arguments[j].cfgDtlCd
                    });
                }
            }
        });


        //工行卡贷业务显示狮桥对客合同+三方对客合同
        var prjTypCd="${prjTypCd}";
        //金融机构编号
        var insCode = "${insCode}";
        if(prjTypCd === "GHKD" || insCode==="icbc"){
            $("#sqLsCnt").show();
            $("#thirdLsCnt").show();
            $("#thirdVideo").show();
        }

        $("#pageloading").hide();



    });

    //保单资料
    function uploadInsPlcBscInfoFile(plcId,prjId){
        Add_navTab('insPlcBscInfo'+plcId,'保单资料信息','<%=path%>/project/prjFileCfgInfo/toInsPlcBscInfoFileInfoListPageDetail.do?cstMgrOrgCd=${cstMgrOrgCd}&ctrlKey=${ctrlKey}'+'&plcId='+plcId+'&prjId='+prjId);
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    //删除文件
    function delFile(_fileId,_orgCd,typ){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'id':${id},'prjPrdDtlId':${prjPrdDtlId},'fileId':_fileId,'orgCd':_orgCd},
            url: '<%=path%>/capital/capPayInfo/removeMate.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    if(typ==1){
                        parent.$('li[tabid="mateTab"] a').text('放款资料('+msg.data+')');
                        mateGrid.reload();
                    }else if(typ==2){
                        cstFileInfoCfgGrid.reload();
                    }else if(typ==3){
                        prjFileInfoCfgGrid.reload();
                    }else if(typ==4){
                        sqLsCntGrid.reload();
                    }else if(typ==5){
                        thirdLsCntGrid.reload();
                    }else if(typ==6){
                        thirdVideoGrid.reload();
                    }
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //删除所选发票信息
    function removeInvoice(_fileId,_orgCd) {
        $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
            if (flag == false) return;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: {"fileId":_fileId},
                url: '<%=path%>/project/prjPrdInvoice/removeInvoice.do',
                success: function (msg) {
                    if (msg.success == 1) {
                        delFile(_fileId,_orgCd);
                        invoiceGrid.reload();
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    }

    //修改资料的验证状态
    function modifyAudStsCd(_fileId,_audStsCd,typ){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/capital/capPayInfo/modifyAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    if(typ==1){
                        mateGrid.reload();
                    }else if(typ==2){
                        cstFileInfoCfgGrid.reload();
                    }else if(typ==3){
                        prjFileInfoCfgGrid.reload();
                    }else if(typ==4){
                        sqLsCntGrid.reload();
                    }else if(typ==5){
                        thirdLsCntGrid.reload();
                    }else if(typ==6){
                        thirdVideoGrid.reload();
                    }else if(typ==7){
                        invoiceGrid.reload();
                    }
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    function onChangefile_multi(e,cfgCd,cfgDtlCd,orgCd,typ) {
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        var filePath="";
        if(typ==1){
            filePath="capital/capPayInfo";
        }else if(typ==2){
            filePath="customer";
        }else if(typ==3 || typ==4 ||typ==5){
            filePath="prjFileInfo";
        }

        if (cfgCd == 'PRJ015' && cfgDtlCd == '90') {
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: {prjPrdDtlId: '${prjPrdDtlId}', prjId: '${prjId}', paySchNo: '${paySchNo}'},
                url: '<%=path%>/capital/capPayInfo/selectVehInfoByPrjPrdDtlId.do',
                success: function (msg) {
                    if (msg.success == '1') {
                        if (CollectionUtils.isNotEmpty(msg.data.vehInfoFileList)) {
                            top.$.ligerDialog.SQalert({content: "合格证最多上传一个", SQ_type: "error"});
                            wait_dialog.close();
                        } else {
                            uploadFile(e, cfgCd, cfgDtlCd, orgCd, typ, filePath);
                            wait_dialog.close();
                        }
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        wait_dialog.close();
                    }
                }
            });
        } else {
            uploadFile(e, cfgCd, cfgDtlCd, orgCd, typ, filePath);
            wait_dialog.close();
        }
    }

    function uploadFile(e, cfgCd, cfgDtlCd, orgCd, typ, filePath) {
        $.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
            secureuri: false,
            fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
            dataType: 'json',
            data: {filePath: filePath},
            success: function (msg) {
                if (msg.success == 1) {
                    if(typ==1 || typ==4 ||typ==5) {
                        $.ajax({
                            type: 'post',
                            dataType: 'json',
                            data: {
                                'fileParams': JSON.stringify(msg.data),
                                'prjPrdDtlId': $("#prjPrdDtlId").val(),
                                'prjId': $("#prjId").val(),
                                'cfgCd': cfgCd,
                                'cfgDtlCd': cfgDtlCd,
                                'id': $("#payId").val(),
                                'orgCd': orgCd
                            },
                            url: '<%=path%>/capital/capPayInfo/uploadMate.do',
                            success: function (msg) {
                                if (msg.success == 1) {
                                    if(typ == 1){
                                        parent.$('li[tabid="mateTab"] a').text('放款资料(' + msg.data + ')');
                                        mateGrid.reload();
                                    }else if(typ == 4){
                                        sqLsCntGrid.reload();
                                    }else{
                                        thirdLsCntGrid.reload();
                                    }
                                } else {
                                    $.ligerDialog.SQalert({content: "资料上传失败", SQ_type: "error"});
                                }
                            }
                        });
                    }else if(typ==2){
                        $.ajax({
                            type: 'post',
                            dataType: 'json',
                            data: {'fileParams':JSON.stringify(msg.data),'cstId':$("#cstId").val(),'cfgCd':cfgCd,'cfgDtlCd':cfgDtlCd,'orgCd':orgCd},
                            url: '<%=path%>/project/prjFileInfo/uploadCstFile.do',
                            success: function (msg) {
                                if (msg.success == 1) {
                                    cstFileInfoCfgGrid.reload();
                                }else{
                                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                }
                                $.ligerDialog.hide();
                            }
                        });
                    }else if(typ==3){
                        $.ajax({
                            type: 'post',
                            dataType: 'json',
                            data: {'fileParams':JSON.stringify(msg.data),'prjId':$("#prjId").val(),'cfgCd':cfgCd,'cfgDtlCd':cfgDtlCd,'orgCd':orgCd},
                            url: '<%=path%>/project/prjFileInfo/uploadPrjFile.do',
                            success: function (msg) {
                                if (msg.success == 1) {
                                    prjFileInfoCfgGrid.reload();
                                }else{
                                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                }
                                $.ligerDialog.hide();
                            }
                        });
                    }
                } else {
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }
    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else if(SQ.regs.img.test(_url)){
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }
    function downloadFileByUrl(tabNm) {
        var data;
        if(tabNm == 'mateGrid'){
            data = mateGrid.getData();
        }else if(tabNm == 'invoiceGrid'){
            data = invoiceGrid.getData();
        }else if(tabNm == 'prjFileInfoCfgGrid'){
            data = prjFileInfoCfgGrid.getData();
        }else if(tabNm == 'cstFileInfoCfgGrid'){
            data = cstFileInfoCfgGrid.getData();
        }else if(tabNm == 'sqLsCntGrid'){
            data = sqLsCntGrid.getData();
        }else if(tabNm == 'thirdLsCntGrid'){
            data = thirdLsCntGrid.getData();
        }else if(tabNm == 'thirdVideoGrid'){
            data = thirdVideoGrid.getData();
        }else{
            $.ligerDialog.SQalert({content:"数据错误，请刷新后重试！", SQ_type: "error"});
            return;
        }
        var ids = [];
        for (var i = 0; i < data.length; i++) {
            if(data[i].fileId){
                ids.push(data[i].fileId);
            }
        }
        if(ids.length <= 0){
            $.ligerDialog.SQalert({content:"没有要下载的附件！", SQ_type: "error"});
            return;
        }
        var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do';
        var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }

    function makeUploaders(gridNm, typ) {
        var filePath="";
        if(typ==1){
            filePath="/customer/";
        }else if(typ==2){
            filePath="/prjFileInfo/";
        }
        var userInfo = {userId:"${currentUsrId}", md5:"", filePath:filePath};
        var chunkSize = 5000 * 1024;        //分块大小
        var originFileName = null;          //原始文件名称
        var uniqueFileName = null;          //文件唯一标识符
        var fileExt = null;
        var md5Mark = null;

        var backEndUrl = '<%=path%>/system/sysulfilesrec/tillFileUpload.do';
        var backStatusUrl = '<%=path%>/system/sysulfilesrec/tillFileUploadStatus.do';
        var uploader = WebUploader.create({
            swf: "Uploader.swf"
            , server: backEndUrl
            , resize: false
            , compress: false
            , prepareNextFile: true
            , chunked: true
            , chunkSize: chunkSize
            , threads: 3
            , formData: $.extend(true, {}, userInfo)
            , fileNumLimit: 1
            //, fileSingleSizeLimit: 1000 * 1024 * 1024
            , duplicate: true
        });
        uploader.on("fileQueued", function(file){
            var selectedRowId = file.source._refer.parents('.l-grid-row').attr('id');
            var rowId = selectedRowId.slice(selectedRowId.lastIndexOf("|")+1);
            var rowData = liger.get(gridNm).getRow(rowId);
            opts = {cfgCd:rowData.cfgCd,cfgDtlCd:rowData.cfgDtlCd,orgCd:rowData.orgCd};
            var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            uploader.upload();
        });
        uploader.on("uploadStart", function(file){
            originFileName = file.name;
            fileExt = file.ext;
            uniqueFileName = md5(''+userInfo.userId+file.name+file.type+file.lastModifiedDate+file.size+new Date().getTime());
            md5Mark = uniqueFileName;
            userInfo.md5 = uniqueFileName;
        });
        uploader.on('uploadBeforeSend', function(block, data, headers) {
            // 修改data可以控制发送哪些携带数据。
            data.originFileName = originFileName;
            data.fileName = uniqueFileName;
            data.ext = fileExt;
            //分片验证是否已传过，用于断点续传
            var task = new $.Deferred();
            $.ajax({
                type: "POST"
                , url: backStatusUrl
                , data: {
                    status: "chunkCheck"
                    , originFileName: originFileName
                    , fileName: uniqueFileName
                    , chunkIndex: block.chunk
                    , size: block.end - block.start
                    , filePath:filePath
                }
                , cache: false
                , timeout: 5000 //todo 超时的话，只能认为该分片未上传过
                , dataType: "json"
            }).then(function(data, textStatus, jqXHR){
                if(data.success == 2){   //若存在，返回失败给WebUploader，表明该分块不需要上传
                    task.resolve();
                }else{
                    task.reject();
                }
            }, function(jqXHR, textStatus, errorThrown){    //任何形式的验证失败，都触发重新上传
                task.resolve();
            });
            return $.when(task);
        });
        uploader.on("uploadComplete", function(file){
            var chunksTotal = 0;
            if((chunksTotal = Math.ceil(file.size/chunkSize)) > 1){
                //合并请求
                var task = new $.Deferred();
                $.ajax({
                    type: "POST"
                    , url: backStatusUrl
                    , data: {
                        status: "chunksMerge"
                        , originFileName: originFileName
                        , fileName: uniqueFileName
                        , chunks: chunksTotal
                        , ext: file.ext
                        , md5: md5Mark
                        , filePath:filePath
                    }
                    , cache: false
                    , dataType: "json"
                }).then(function(data, textStatus, jqXHR){
                    task.resolve();
                    if(data.success==1 && Math.ceil(file.size/chunkSize)>1){
                        if(typ==1){
                            $.ajax({
                                type: 'post',
                                dataType: 'json',
                                data: {'fileParams':JSON.stringify(data.data),'cstId':$("#cstId").val(),'cfgCd':opts.cfgCd,'cfgDtlCd':opts.cfgDtlCd,'orgCd':opts.orgCd},
                                url: '<%=path%>/project/prjFileInfo/uploadCstFile.do',
                                success: function (msg) {
                                    if (msg.success == 1) {
                                        cstFileInfoCfgGrid.reload();
                                    }else{
                                        $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                    }
                                    $.ligerDialog.hide();
                                }
                            });
                        }else if(typ==2){
                            $.ajax({
                                type: 'post',
                                dataType: 'json',
                                data: {'fileParams':JSON.stringify(data.data),'prjId':$("#prjId").val(),'cfgCd':opts.cfgCd,'cfgDtlCd':opts.cfgDtlCd,'orgCd':opts.orgCd},
                                url: '<%=path%>/project/prjFileInfo/uploadPrjFile.do',
                                success: function (msg) {
                                    if (msg.success == 1) {
                                        thirdVideoGrid.reload();
                                    }else{
                                        $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                    }
                                    $.ligerDialog.hide();
                                }
                            });
                        }
                    }else if(data.success!=1) {
                        //wait_dialog.close();
                        $.ligerDialog.SQalert({content: data.info, SQ_type: "error"});
                    }
                    uploader.removeFile(file);//上传成功后移除队列文件
                }, function(jqXHR, textStatus, errorThrown){
                    task.reject();
                });
                uploader.removeFile(file);//上传成功后移除队列文件
                return $.when(task);
            }else{
                uploader.removeFile(file);//上传成功后移除队列文件
            }
        });
        uploader.on('uploadAccept', function(obj, ret) {
            if(ret.success==1 && Math.ceil(obj.file.size/chunkSize)<=1){
                if(typ==1){
                    $.ajax({
                        type: 'post',
                        dataType: 'json',
                        data: {'fileParams':JSON.stringify(ret.data),'cstId':$("#cstId").val(),'cfgCd':opts.cfgCd,'cfgDtlCd':opts.cfgDtlCd,'orgCd':opts.orgCd},
                        url: '<%=path%>/project/prjFileInfo/uploadCstFile.do',
                        success: function (msg) {
                            if (msg.success == 1) {
                                cstFileInfoCfgGrid.reload();
                            }else{
                                $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                            }
                            $.ligerDialog.hide();
                        }
                    });
                }else if(typ==2){
                    $.ajax({
                        type: 'post',
                        dataType: 'json',
                        data: {'fileParams':JSON.stringify(ret.data),'prjId':$("#prjId").val(),'cfgCd':opts.cfgCd,'cfgDtlCd':opts.cfgDtlCd,'orgCd':opts.orgCd},
                        url: '<%=path%>/project/prjFileInfo/uploadPrjFile.do',
                        success: function (msg) {
                            if (msg.success == 1) {
                                thirdVideoGrid.reload();
                            }else{
                                $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                            }
                            $.ligerDialog.hide();
                        }
                    });
                }
            }
        });
        return uploader;
    }
	function addPrjfiles(obj){
		var selectedRows ;
		var tabNm="PRJ_PRD_DTL";
		if(obj == 'mateGrid'){
			selectedRows = mateGrid.getSelectedRows();
			tabNm="PRJ_PRD_DTL";
        }else if(obj == 'prjFileInfoCfgGrid'){
        	selectedRows = prjFileInfoCfgGrid.getSelectedRows();
        	tabNm="PRJ_BSC_INFO";
        }
		console.log(JSON.stringify(selectedRows));
		
		$.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileParams':JSON.stringify(selectedRows),"tabNm":tabNm,'prjId':'${prjId}','prjPrdDtlId':'${prjPrdDtlId}',prjTypCd:'${prjTypCd}',cstId:'${cstId}'},
            url: '<%=path%>/project/prjfile/prjFileRec/add.do',
            success: function (msg) {
                if (msg.success == 1) {
                	 $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                }else{
                    $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                }
                
            }
        });
	}

    //发票上传
    function uploadInvoice(id,paySchNo){
        if(null==id){
            top.$.ligerDialog.SQalert({content: "未找到产品明细id",SQ_type: "error"});
            return;
        }
        var callback = function(){
            grid.reload();
        }
        Add_navTab( 'tab_prj_prd_invoice_detail'+id,'发票上传','<%=path%>/project/prjPrdInvoice/toListPage.do?detailFlag='+true+'&&dtlId='+id+'&&paySchNo='+paySchNo+'&&ywParam=1',callback);
    }
</script>

</body>
</html>
